	<include file='Common:header' />

		<!-- /section:basics/navbar.layout -->
		<div class="main-container" id="main-container">

			<!-- #section:basics/sidebar -->

	<include file='Common:left' />


			<!-- /section:basics/sidebar -->
			<div class="main-content">
				<div class="main-content-inner">
					<div class="page-content">

                        
                        
                        <!--主题-->
						<div class="page-header">
							<h1>
								您当前操作
								<small>
									<i class="ace-icon fa fa-angle-double-right"></i>
									添加系统管理员
								</small>
							</h1>
						</div>
						<div class="row">
							<div class="col-xs-12">
								<form class="form-horizontal" name="admin_list_add" id="admin_list_add" method="post" action="__URL__/admin_list_runadd">
                                	<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 所属用户组： </label>
										<div class="col-sm-10">
                                        <select name="group_id"  class="col-sm-4" >
                                        <option value="">请选择所属用户组</option>
                                        <foreach name="auth_group" item="v">
                                        <option value="{$v.id}">{$v.title}</option>
                                        </foreach>
                                        </select>
                                        </div>
									</div>
									<div class="space-4"></div>
																		
									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 登录用户名：  </label>
										<div class="col-sm-10">
											<input type="text" name="admin_username" id="admin_username" placeholder="输入登录用户名" class="col-xs-10 col-sm-4" />
											<span class="lbl">&nbsp;&nbsp;<span class="red">*</span>用户名必须是以字母开头，数字、符号组合</span>
										</div>
									</div>
                                    <div class="space-4"></div>
																		
									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 登录密码：  </label>
										<div class="col-sm-10">
											<input type="text" name="admin_pwd" id="admin_pwd" placeholder="输入登录密码" class="col-xs-10 col-sm-4" />
											<span class="lbl">&nbsp;&nbsp;<span class="red">*</span>密码必须大于6位，小于15位</span>
										</div>
									</div>
                                    <div class="space-4"></div>

									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 用户邮箱：  </label>
										<div class="col-sm-10">
											<input type="text" name="admin_email" id="admin_email" placeholder="输入用户邮箱" class="col-xs-10 col-sm-4" />
											<span class="lbl">&nbsp;&nbsp;<span class="red">*</span>用于密码找回，请认真填写</span>
										</div>
									</div>
                                    <div class="space-4"></div>

									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 手机号码：  </label>
										<div class="col-sm-10">
											<input type="text" name="admin_tel" id="admin_tel" placeholder="输入手机号码" class="col-xs-10 col-sm-4" />
											<span class="lbl">&nbsp;&nbsp;<span class="red">*</span>只能填写数字</span>
										</div>
									</div>
                                    <div class="space-4"></div>
									
									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 通用网名：  </label>
										<div class="col-sm-10">
											<input type="text" name="admin_realname" id="admin_realname" placeholder="输入通用网名" class="col-xs-10 col-sm-4" />
											<span class="lbl">&nbsp;&nbsp;<span class="red">*</span>用于发布信息所有人，且在前端显示</span>
										</div>
									</div>
                                    <div class="space-4"></div>
									
									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 是否审核： </label>
										<div class="col-sm-10" style="padding-top:5px;">
                                            <input name="admin_open" id="admin_open" value="1" class="ace ace-switch ace-switch-4 btn-flat" type="checkbox" />
											<span class="lbl">&nbsp;&nbsp;默认关闭</span>
										</div>
									</div>
                                    <div class="space-4"></div>

									<div class="clearfix form-actions">
										<div class="col-md-offset-3 col-md-9">
											<button class="btn btn-info" type="submit">
												<i class="ace-icon fa fa-check bigger-110"></i>
												保存
											</button>

											&nbsp; &nbsp; &nbsp;
											<button class="btn" type="reset">
												<i class="ace-icon fa fa-undo bigger-110"></i>
												重置
											</button>
										</div>
									</div>
								</form>
                        	</div>
                        </div>
									<div class="hr hr-24"></div>

<include file='Common:header_nav' />

					</div><!-- /.page-content -->
				</div>
			</div><!-- /.main-content -->

	<include file='Common:footer' />

		</div><!-- /.main-container -->

    		<!--下拉样式以及JS-->
		<link rel="stylesheet" href="__PUBLIC__/assets/css/chosen.css" />
		<script src="__PUBLIC__/assets/js/chosen.jquery.js"></script>
		<script type="text/javascript">
			jQuery(function($) {
				if(!ace.vars['touch']) {
					$('.chosen-select').chosen({allow_single_deselect:true}); 
					$(window)
					.off('resize.chosen')
					.on('resize.chosen', function() {
						$('.chosen-select').each(function() {
							 var $this = $(this);
							 $this.next().css({'width': $this.parent().width()});
						})
					}).trigger('resize.chosen');
			
				}
			});
		</script>
<script>
$(function(){
	$('#admin_list_add').ajaxForm({
		beforeSubmit: checkForm, // 此方法主要是提交前执行的方法，根据需要设置
		success: complete, // 这是提交后的方法
		dataType: 'json'
	});
	
	function checkForm(){
		if( '' == $.trim($('#admin_username').val())){
			layer.alert('登录用户名不能为空', {icon: 6}, function(index){
 			layer.close(index);
			$('#admin_username').focus(); 
			});
			return false;
		}
		
		var admin_username = $.trim($('input[name="admin_username"]').val()); //获取INPUT值
		var myReg = /^[\u4e00-\u9fa5]+$/;//验证中文
		if(admin_username.indexOf(" ")>=0)
		{
			layer.alert('登录用户名包含了空格，请重新输入', {icon: 6}, function(index){
 			layer.close(index);
			$('#admin_username').focus(); 
			});
			return false;
		}
		
        if (myReg.test(admin_username)) {
			layer.alert('用户名必须是字母，数字，符号', {icon: 6}, function(index){
 			layer.close(index);
			$('#admin_username').focus(); 
			});
			return false;
        }
		
		if( '' == $.trim($('#admin_pwd').val())){
			layer.alert('密码不能为空', {icon: 6}, function(index){
 			layer.close(index);
			$('#admin_pwd').focus(); 
			});
			return false;
		}
		
		if( $.trim($('#admin_pwd').val()).length < 6){
			layer.alert('密码不能少于6位', {icon: 6}, function(index){
 			layer.close(index);
			$('#admin_pwd').focus(); 
			});
			return false;
		}
		
		if( '' == $.trim($('#admin_email').val())){
			layer.alert('用户邮箱不能为空', {icon: 6}, function(index){
 			layer.close(index);
			$('#admin_email').focus(); 
			});
			return false;
		}
		
		if( '' == $.trim($('#admin_tel').val())){
			layer.alert('手机号码不能为空', {icon: 6}, function(index){
 			layer.close(index);
			$('#admin_tel').focus(); 
			});
			return false;
		}
		
		if( '' == $.trim($('#admin_realname').val())){
			layer.alert('通用网名不能为空', {icon: 6}, function(index){
 			layer.close(index);
			$('#admin_realname').focus(); 
			});
			return false;
		}
		
		
		
 }
	function complete(data){
		if(data.status==1){
			layer.alert(data.info, {icon: 6}, function(index){
 			layer.close(index);
			window.location.href=data.url;
			});
		}else{
			layer.alert(data.info, {icon: 6}, function(index){
 			layer.close(index);
			$('#admin_username').focus(); 
			});
			return false;	
		}
	}
 
});
</script>
	</body>
</html>
